package com.example.tesecond.mapper;

import com.example.tesecond.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from main ")
    List <User> findAll();

    @Insert("insert into main values(NULL,#{username},#{content})")
    void  add(@Param("username")String  username,@Param("content")String  content);

@Delete("delete from main where id=#{id}")
    void delete(@Param("id")int  id);


@Select("select * from main where id=#{id}")
    User findById(@Param("id")int id);

@Update("update main set username=#{username},content=#{content} where id=#{id} ")
  void update(@Param("username")String  username,@Param("content")String  content,@Param("id")int id );
}
